package didi;
import java.util.*;

/**
 * 求数组中第K大的数
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            String[] str = sc.nextLine().split(" ");
            int[] arr = new int[str.length];
            for (int i = 0; i < str.length; i++){
                arr[i] = Integer.parseInt(str[i]);
            }
            int k = sc.nextInt();
            System.out.println(findKMax(arr, k));
        }
    }

    public static int findKMax(int[] nums, int k) {
        PriorityQueue<Integer> queue = new PriorityQueue<Integer>(k);
        for (int i : nums) {
            queue.offer(i);
            if (queue.size() > k) {
                queue.poll();
            }
        }
        return queue.peek();
    }

}
